package cn.smart.epic.common.warpper;

import java.util.List;
import java.util.Map;

/**
 * @Auther Uncle_Z
 * @date 2017/9/14 0:39
 * @Email:2545375@qq.com
 * @Descrition
 * @since 1.0
 */

public abstract class BaseControllerWarpper {

    public Object obj = null;

    public BaseControllerWarpper(Object obj) {
        this.obj=obj;
    }

    public Object warp() {
        if (this.obj instanceof List) {
            List<Map<String,Object>> list = (List<Map<String,Object>>) this.obj;
            for(Map<String,Object> map :list){
                warpTheMap(map);
            }
            return list;
        }else if(this.obj instanceof Map){
            Map<String, Object> map =(Map<String, Object>)this.obj;
            warpTheMap(map);
            return map;
        } else {
            return this.obj;
        }

    }

    protected abstract void warpTheMap(Map<String, Object> map);
}
